Example 3 - Create and Save Under a New File Name

Summary:

This program starts Milestones Professional, creates a new file, adds a symbol on task rowA horizontal row on the schedule, usually containing the name of a project step and important milestone dates for that step. 1, and then saves the file under file name: "Test File From VBA.MLG"

Example Code:

Public Sub Example3()

Set objMilestones = CreateObject("Milestones")

With objMilestones

 

 

.Activate

 

.AddSymbol 1, "11/12/2018", 2

 

nFileHandleVariant = 0

 

 

 

nFileHandleVariant = .Save("c:\myfiles\"+ "Test File From VBG.MLG")

 

nFileHandleInt = nFileHandleVariant

 

If (nFileHandleInt = 0) Then

 

 

 

MsgBox "File Save Failed"

 

End If

 

.Refresh

 

.Close

End With

Exit Sub

End Sub

  Notes:

    • In this example the .CreateObject command causes Milestones to start and create a new schedule.

    • The path to the Milestones Professional charts folder is obtained from the miles.ini that is created in the Windows folder when Milestones Professional is installed.

    • The complete path and file name, including the .MLF file extension must be included on the .Save Command.

    • Passing a bad file name or path to the .Save command causes Milestones to display an error dialog box.

    • Visit the KIDASA Software programmer's page for more examples

 

visit our programmer's page for more examples

 

Milestones Professional 2019 Automation Methods and Properties.  © Copyright 2018, KIDASA Software, Inc. All rights reserved.